/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.tcc.view;

import br.com.tcc.dao.DAOContasBancarias;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.hibernate.HibernateException;

/**
 *
 * @author Edidelson
 */
public class ScreensFramework extends Application {

    public static String principal = "main";
    public static String principalFile = "FXMLDocument.fxml";
    public static String contasBancarias = "contasBancarias";
    public static String contasBancariasFile = "ContasBancarias.fxml";
    public static String receitaDespesa = "receitaDespesa";
    public static String receitaDespesaFile = "ReceitaDespesa.fxml";
    public static String lancamento = "lancamento";
    public static String lancamentoFile = "Lancamento.fxml";
    public static String grafico = "grafico";
    public static String graficoFile = "Grafico.fxml";

    @Override
    public void start(Stage stage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource(principalFile));
        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
        new Thread(new Conexao()).start();
    }

    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

    class Conexao implements Runnable {

        @Override
        public void run() {
            // Iniciando barra de progresso
            try {
                new DAOContasBancarias().consultar(0);
            } catch (HibernateException ex) {
                ex.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
}
